from rest_framework.permissions import BasePermission


class IsAdminUser(BasePermission):
    def has_permission(self, request, view):
        return request.user.groups.filter(name='管理员').exists()


class IsReseacherUser(BasePermission):
    def has_permission(self, request, view):
        return request.user.groups.filter(name='研究员').exists()


class IsStudentUser(BasePermission):
    def has_permission(self, request, view):
        return request.user.groups.filter(name='学生').exists()
